#version 330 core
out vec4 FragColor;

in vec3 FragPos;
in vec3 Normal;
in vec2 TexCoord;

uniform samplerCube skyboxTex; // 天空盒纹理

uniform vec3 viewPos;

void main()
{
    vec3 norm = normalize(Normal);

    // 计算反射
    vec3 I = normalize(FragPos - viewPos);
    vec3 R = reflect(I, norm);
    vec3 result = texture(skyboxTex, R).rgb;

    // 计算折射
    // float ratio = 1.00 / 1.52;
    // R = refract(I, norm, ratio);
    // vec3 result = texture(skyboxTex, R).rgb;

    FragColor = vec4(result, 1.0);
}